﻿using System;
using System.ServiceModel;
using SilenthinkContract.Domain;
using System.Collections.Generic;

namespace SilenthinkContract
{
    [ServiceContract(Namespace = ServiceContract.Namespace)]
    public interface IAuctionService : IService
    {
        #region Auction
        [OperationContract]
        bool CreateAuction(Auction o);
        [OperationContract]
        bool UpdateAuction(Auction o);
        [OperationContract]
        bool DeleteAuction(long id);
        /// <summary>
        /// 生成拍品订单
        /// </summary>
        /// <param name="auctionId">拍品Id</param>
        /// <returns>拍品订单Id</returns>
        [OperationContract]
        string Buy(long auctionId);
        /// <summary>
        /// 计算某用户在某拍品上所花费金额
        /// </summary>
        /// <param name="userId">用户id</param>
        /// <param name="auctionId">拍品Id</param>
        /// <param name="begin">开始时间</param>
        /// <returns>所花费总金额</returns>
        [OperationContract]
        int SumBid(long userId, long auctionId, DateTime? begin = null);
        [OperationContract]
        Auction GetAuction(long id);
        [OperationContract]
        IList<Auction> GetAllAuction();
        [OperationContract]
        PageList<Auction> GetPagedAuction(int page = 1, int size = 20);
        #endregion

        #region Bidding
        [OperationContract]
        PageList<Bid> GetPagedBidding(int index = 1, int size = 20, long? auctionId = null);
        #endregion

        #region AuctionOrder

        [OperationContract]
        bool CreateAuctionOrder(AuctionOrder o);
        [OperationContract]
        bool UpdateAuctionOrder(AuctionOrder o);
        [OperationContract]
        bool DeleteAuctionOrder(string id);
        [OperationContract]
        AuctionOrder GetAuctionOrder(string id, int? userId = null);
        [OperationContract]
        IList<AuctionOrder> GetAllAuctionOrder();
        [OperationContract]
        PageList<AuctionOrder> GetPagedAuctionOrder(int index = 1, int size = 20, int? userId = 0, AuctionGrade? grade = null, AuctionStatus? status = null);

        #endregion

    }
}